package demo.security.core.social.qq.connect;

import demo.security.core.social.qq.api.QQSocial;
import demo.security.core.social.qq.api.QQSocialImpl;
import org.springframework.social.oauth2.AbstractOAuth2ServiceProvider;

/**
 * QQSocialServiceProvider
 *
 * @author lidj
 * @date 2018-02-05
 */
public class QQSocialServiceProvider extends AbstractOAuth2ServiceProvider<QQSocial> {
    private String appId;

    private static final String URL_AUTHORIZE = "https://graph.qq.com/oauth2.0/authorize";
    private static final String URL_ACCESS_TOKEN ="https://graph.qq.com/oauth2.0/token";

    public QQSocialServiceProvider(String appId,String appSecret) {
        super(new QQOAuth2Template(appId,appSecret,URL_AUTHORIZE,URL_ACCESS_TOKEN));
        this.appId = appId;
    }

    @Override
    public QQSocial getApi(String accessToken) {
        return new QQSocialImpl(accessToken,appId);
    }


}
